package mamma.action;

import java.util.Date;
import java.util.List;
import java.util.Map;

import mamma.dao.jihoonDao;
import mamma.vo.CalendarVo;
import mamma.vo.InformationVo;
import mamma.vo.SaleBoardCommentVo;
import mamma.vo.SaleBoardVo;

import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;

public class jihoonAction extends ActionSupport {
     // 캘린더변스
	 private int id;
	 private String infoName;
	 private String infoContent;
	 private String startDate;
	 private String endDate;
	 private int importance;
	 private String email;
	 private CalendarVo vo;
	 private List<InformationVo> infoList=null,infoList2=null;
	 private InformationVo info;
	 
	 //장터변수
	 	private SaleBoardVo saleVo;
	 	private List<SaleBoardVo> saleList=null;
		private int saleboardnum;
		private String state;
		private String title;
		private String nickname;
		private String content;
		private String inputdate;
		//private String email; 중복
		//private int profile_id;
	 
	 public String clist() throws Exception{
			/*ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");
			if(loginId == null) return Action.LOGIN;*/
			infoList=new jihoonDao().clist();
			infoList2=new jihoonDao().clist2();
			System.out.println("다녀감");
			return SUCCESS;
	 }
	 
	 public String InsertChedule() throws Exception{
		 System.out.println("입력ㄱㄱ");
		 	vo=new CalendarVo();
		 /*ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");
			if(loginId == null) return Action.LOGIN;*/
			vo.setInfoName(infoName);
			vo.setInfoContent(infoContent);
			vo.setStartDate(startDate);
			vo.setEndDate(endDate);
			vo.setEmail(email);
			System.out.println(vo.toString());
			new jihoonDao().scheduleIns(vo);
			
			return SUCCESS;
	 }
	 
	 public String scheduleDel() throws Exception{
		/*ActionContext context = ActionContext.getContext();
		Map<String, Object>session = context.getSession();
		String loginId = (String)session.get("loginId");
		if(loginId == null) return Action.LOGIN;
		if(loginId=="admin1"||loginId=="admin2"||loginId=="admin"){*/
		new jihoonDao().scheduleDelC(id);
		/*}else new jihoonDao().scheduleDelC(id);*/
		return SUCCESS;
	 }
	 
	 public String scheduleShiftC() throws Exception{
		 	/*ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");*/
			vo=new CalendarVo();
			vo.setId(id);
			vo.setStartDate(startDate);
			vo.setEndDate(endDate);
			vo.setEmail(email);
		 	System.out.println(vo.toString());
			//if(loginId == null) return Action.LOGIN;
	 		new jihoonDao().scheduleShiftC(vo);
		 	System.out.println("되나요?");
		
		 return SUCCESS;
	 }
	 
	 public String scheduleUpd() throws Exception{
		 ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");
			vo=new CalendarVo();
			vo.setId(id);
			vo.setInfoName(infoName);
			vo.setInfoContent(infoContent);
			vo.setEmail(email);
			//if(loginId == null) return Action.LOGIN;
		 	//if(loginId!="admin"){
		 		new jihoonDao().scheduleUpd(vo);
		 	//}else{
		 		/*	new jihoonDao().scheduleShiftA();
		 	}*/
		 	System.out.println("수정요?");
		 	System.out.println(vo.toString());
		 return SUCCESS;
	 }
	 public String scheduleScr() throws Exception{
		 	ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");
			vo=new CalendarVo();
			vo.setId(id);
			vo.setEndDate(endDate);
			vo.setEmail(email);
			//if(loginId == null) return Action.LOGIN;
		 	//if(loginId!="admin"){
		 		new jihoonDao().scheduleScr(vo);
		 	//}else{
		 		/*	new jihoonDao().scheduleShiftA();
		 	}*/
		 	System.out.println("수정요?");
		 	System.out.println(vo.toString());
		 return SUCCESS;
	 }
	 /*
//게시판
	 //장터게시판목록
	 public String saleBoardlist() throws Exception {
			ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");
			if(loginId == null) return Action.LOGIN;
			saleList = new jihoonDao().listSaleBoardVo();
			System.out.println(saleList.toString());
			System.out.println("asdfadsf");
			return SUCCESS;
		}
	 	//장터게시판 글등록
		public String WriteReservationSaleBoard() throws Exception {
			ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");
			if(loginId == null) return Action.LOGIN;

			int check  = new jihoonDao().WriteReservationSaleBoard(saleVo);
			return SUCCESS;
		}
		//장터게시판 글읽기
		public String readSaleBoard() throws Exception {
			ActionContext context = ActionContext.getContext();
			Map<String, Object>session = context.getSession();
			String loginId = (String)session.get("loginId");
			//saleVo.setEmail(loginId);
			//System.out.println(saleVo.getEmail());
			saleVo=new SaleBoardVo();
			saleVo.setSaleboardnum(saleboardnum);
			jihoonDao jisung=new jihoonDao();
			saleVo=jisung.readSaleBoard(saleVo);
			System.out.println(saleVo.toString());
			return SUCCESS;
		}
		//장터게시판 글수정 목록이동
		public String GoUpdateFormSaleBoard() throws Exception {
				//saleVo.
			
			new jihoonDao().GoUpdateFormSaleBoard(saleVo);
			return SUCCESS;
		}
		
		//장터게시판 글수정
		public String UpdateReservationSaleBoard() throws Exception {
			int check  = new jihoonDao().UpdateReservationSaleBoard(saleVo);
			return SUCCESS;
		}
		//장터게시판 글삭제
		public String DeleteSaleBoard() throws Exception {
			int check = new jihoonDao().DeleteSaleBoard(saleboardnum);
			return SUCCESS;
		}*/
	 
/*	 //리플
	 public List<SaleBoardCommentVo> srList(){
		 List<SaleBoardCommentVo> list=null;
		 try {
			
		} catch (Exception e) {
			// TODO: handle exception
		}
		 
		 return list;
	 }
	 */

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getInfoName() {
		return infoName;
	}

	public void setInfoName(String infoName) {
		this.infoName = infoName;
	}

	public String getInfoContent() {
		return infoContent;
	}

	public void setInfoContent(String infoContent) {
		this.infoContent = infoContent;
	}

	public String getStartDate() {
		return startDate;
	}

	public void setStartDate(String startDate) {
		this.startDate = startDate;
	}

	public String getEndDate() {
		return endDate;
	}

	public void setEndDate(String endDate) {
		this.endDate = endDate;
	}

	public int getImportance() {
		return importance;
	}

	public void setImportance(int importance) {
		this.importance = importance;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public CalendarVo getVo() {
		return vo;
	}

	public void setVo(CalendarVo vo) {
		this.vo = vo;
	}

	public List<InformationVo> getInfoList() {
		return infoList;
	}

	public void setInfoList(List<InformationVo> infoList) {
		this.infoList = infoList;
	}

	public List<InformationVo> getInfoList2() {
		return infoList2;
	}

	public void setInfoList2(List<InformationVo> infoList2) {
		this.infoList2 = infoList2;
	}

	public InformationVo getInfo() {
		return info;
	}

	public void setInfo(InformationVo info) {
		this.info = info;
	}
	//장터게시판

	public List<SaleBoardVo> getSaleList() {
		return saleList;
	}

	public void setSaleList(List<SaleBoardVo> saleList) {
		this.saleList = saleList;
	}

	public int getSaleboardnum() {
		return saleboardnum;
	}

	public void setSaleboardnum(int saleboardnum) {
		this.saleboardnum = saleboardnum;
	}

	public String getState() {
		return state;
	}

	public void setState(String state) {
		this.state = state;
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	public String getInputdate() {
		return inputdate;
	}

	public void setInputdate(String inputdate) {
		this.inputdate = inputdate;
	}

	public SaleBoardVo getSaleVo() {
		return saleVo;
	}

	public void setSaleVo(SaleBoardVo saleVo) {
		this.saleVo = saleVo;
	}
	
	
	
}

